home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94a.txt
/
000058_icon-group-sender _Mon Feb 21 06:28:54 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-08-19
|
3KB
From: icon-group-sender
Message-Id: <199402211618.AA08254@cheltenham.cs.arizona.edu>
Received: by cheltenham.cs.arizona.edu; Mon, 21 Feb 1994 09:18:41 MST
Subject: Re: generating both [lr]values of records
To: jeffery@ringer.cs.utsa.edu (Clinton L. Jeffery)
Date: Mon, 21 Feb 1994 06:28:54 -0700 (MST)
Cc: icon-group
In-Reply-To: <9402210630.AA27481@ringer.cs.utsa.edu.sunset> from "Clinton L. Jeffery" at Feb 21, 94 00:30:21 am
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
> Peter Bigot writes about record lvalues:
> # What I'd like:
> # every !ar := (¤tgenelt)+1
> # but for some reason that doesn't work....
>
> Peter, !r does generate assignable references to record r's fields, but its
> easy to inadvertently get yourself in trouble in the surrounding expression
> (the usual mistake is to try to assign each field different results from a
> generator; you need a co-expression for parallel evaluation of generators).
Hmn; yeah, I suppose I could do:
lval := create !ar
rval := create !ar
while (@lval := @rval+1)
That does what I want. Or even:
rval := create !ar
every !ar := (@rval+1)
Which is getting back to the succinctness and incomprehensibility I like to
have in my Icon programs. Isn't that going to be pretty expensive in
time/space too, though? How does it compare to constructing a list of new
fields and using string evaluation on the record constructor? I suppose I
could do timing tests, but I'd rather appeal to intuition (even if it isn't
mine).
This is an extremely small but potentially high-frequency part of what's
looking to be an ugly program that will probably be _very_ slow; but it's a
research tool, what do you want? ;-)
> Anyhow, check out the following program, which assigns new values to a
> record's fields (it writes out 1, 2, 3, and 4 on separate lines).
Thanks; unfortunately, that doesn't seem to show how you can use the current
value of the field being assigned to construct the new value. In the actual
context, I can't reconstruct the current value from base principles.
It'd be "cool"(tm) if one could use a keyword or some other feature to
get multiple references to the currently-generated element within an
expression, although this probably has semantic overtones I'd rather not
think about at this hour of the morning.
Peter
--
Peter A. Bigot -- pab@CS.Arizona.EDU
Dept. of Computer Science, University of Arizona, Tucson AZ